<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>编辑公告 - Powered By Betou</title>
<meta name="author" content="Betou Team" />
<meta name="copyright" content="Betou" />
<#include "../head.html"/>
<script type="text/javascript" src="${base}/thirdparty/editor/xheditor-1.2.1.min.js"></script>
<script type="text/javascript" src="${base}/thirdparty/editor/xheditor_lang/zh-cn.js"></script>
<script type="text/javascript" src="${base}/thirdparty/editor/editor.js"></script>

<script type="text/javascript">
var groups = '${bean.orientedGroup!}';
var smsGroups = '${bean.smsSendGroup!}';

$().ready(function() {

	$("#inputForm input[name*=mxGroups]").each(function() {
		var role = $(this).val();
		for(var i=0,len=groups.length;i<len;i++) {
			if(groups[i]==role) {
				$(this).attr("checked",true);
				break;
			}
		}
	});

	$("#inputForm input[name*=smsGroups]").each(function() {
		var role = $(this).val();
		var smsGroupArr = smsGroups.split(',');
		for(var i=0,len=smsGroupArr.length;i<len;i++) {
			if(smsGroupArr[i]==role) {
				$(this).attr("checked",true);
				break;
			}
		}
	});
	
	var $inputForm = $("#inputForm");
	 //表单验证
	$inputForm.validate({
		rules: {
			title:{
				required: true,
				maxlength: 80,
			},
			smsContent:{
				maxlength:70
			},
			<#if !admin.system>
			mxGroups:"required",
			</#if>
			content:{
				required: true,
				maxlength: 2000
			}
		}
	});

	<#if !admin.system>
	loadSmsNumAndUseNum("immediately", "smsGroups");
	$("#inputForm input[name*=smsGroups]").click(function(){
		loadSmsNumAndUseNum("immediately", "smsGroups");
	})
	</#if>

	initEditor();
});
</script>
</head>
<body class="content">
	<div class="path">
		<a href="../index.jspx">首页</a> &raquo; 编辑公告 &raquo; ${bean.title!}
	</div>
	<form id="inputForm" action="o_update.jspx" method="post">
		<input type="hidden" name="id" value="${bean.id!}" />
		<table class="input">
			<#if groupList??>
			<tr>
				<th><span class="requiredField">*</span>面向用户组：</th>
				<td>
					<#list groupList as g>
						<input type="checkbox" name="mxGroups" value="${g.id}"/>${g.name!}
					</#list>
				</td>
			</tr>
			<tr>
				<th>短信发送：</th>
				<td>
					<#if group??>
						<input type="checkbox" name="smsGroups" value="${group.id}"/><span class="red">${group.name!}</span>
					</#if>
					<#list groupList as g>
						<input type="checkbox" name="smsGroups" value="${g.id}"/>${g.name!}
					</#list>
				</td>
			</tr>
			<tr>
				<th>短信内容：</th>
				<td>
					<textarea class="text" name="smsContent" title="最大字符不可超过70个">${bean.smsContent!}</textarea>
				</td>
			</tr>
			<tr>
				<th>设置(<span class="red">短信数量不够，将不会发送短信</span>)：</th>
				<td><input type="checkbox" name="immediately" value="true" checked/>立即发送短信&nbsp;<span id="loading" class="green">正在加载短信信息...</span></td>
			</tr>
			</#if>
			<tr>
				<th><span class="requiredField">*</span>标题:</th>
				<td>
					<input type="text" name="title" class="text" maxlength="80" style="width:350px" value="${bean.title!}"/>
				</td>
			</tr>
			<tr>
				<th><span class="requiredField">*</span>内容:</th>
				<td>
					<textarea class="text"  name="content"  id="at_tab_text">${bean.content!}</textarea>
				</td>
			</tr>
			<tr>
				<td colspan="2">&nbsp;</td>
			</tr>
			<tr>
				<th>&nbsp;</th>
				<td>
					<input type="submit" class="button" value="确&nbsp;&nbsp;定" />
					<input type="button" class="button" value="返&nbsp;&nbsp;回" onclick="location.href='v_list.jspx'" />
				</td>
			</tr>
		</table>
	</form>
	<#include "../footer.html"/>
</body>
</html>